function fileWriterUtility(str_Filename){ 
        try{
           var obj_File = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
           obj_File.initWithPath(str_Filename);
 
           var obj_OutputStream =  Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);
           obj_OutputStream.init(obj_File,0x01,0444,null);

           var obj_ScriptableIO = Components.classes["@mozilla.org/binaryoutputstream;1"].createInstance(Components.interfaces.nsIBinaryOutputStream);
           obj_ScriptableIO.setOutputStream(obj_OutputStream);
        } catch (e) { alert(e); }
 	
	this.fileobject=obj_File;
	this.outputstream=obj_OutputStream;
	this.binarystream=obj_ScriptableIO;
}

fileWriterUtility.prototype.fclose=function() {
	this.binarystream.close();
	this.outputstream.flush();
	this.outputstream.close();
}

fileWriterUtility.prototype.fputc=function(u8) {
	this.binarystream.write8(u8);
}

fileWriterUtility.prototype.fput16be=function(u16) {
	this.binarystream.write8(u16>>8);
	this.binarystream.write8(u16&0xFF);
}

fileWriterUtility.prototype.fput32be=function(u32) {
	this.binarystream.write8(Math.floor(u32/256)>>16);
	this.binarystream.write8((u32>>16)&0xFF);
	this.binarystream.write8((u32>>8)&0xFF);
	this.binarystream.write8(u32&0xFF);
}